package com.springboot.blog.entity;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.springboot.blog.interfaces.ToolInterface;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * <p>
 * 文章表
 * </p>
 *
 * @author 4vsy
 * @since 2020-06-29
 */
@Data
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
public class Article implements Serializable {

    private static final long serialVersionUID = 1L;

    @TableId(value = "id", type = IdType.AUTO)
    @NotNull(message = "ID不能为空!",groups={ToolInterface.update.class})
    private Integer id;

    /**
     * 资讯分类id
     */
    @NotNull(message = "分类不能为空!",groups={ToolInterface.insert.class,ToolInterface.update.class})
    private Integer categoryId;

    /**
     * 封面
     */
    @NotBlank(message = "封面不能为空!",groups={ToolInterface.insert.class,ToolInterface.update.class})
    private String cover;

    /**
     * 标题
     */
    @NotBlank(message = "标题不能为空!",groups={ToolInterface.insert.class,ToolInterface.update.class})
    private String title;

    /**
     * 摘要
     */
    private String introduction;

    /**
     * 内容
     */
    private String content;
    private String contentMarkdown;

    /**
     * 置顶
     */
    private Boolean top;

    /**
     * 推荐
     */
    private Boolean recommend;

    /**
     * 热门
     */
    private Boolean hot;

    /**
     * 浏览量
     */
    private Integer browse;

    /**
     * 顶
     */
    private Integer up;

    /**
     * 创建时间
     */
    @TableField(fill = FieldFill.INSERT)
    private LocalDateTime createTime;

    /**
     * 更新时间
     */
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime updateTime;


}
